/**************************************************************************************
*
*	Copyright (C) 2010 Brent Andrew O. Chua - See LICENSE.txt for more info.
*		
*	Filename	-	ShaderConstant.h
*
*	Description -	Shader data type. This can be uniform(constant) or with a semantic.
*
*	Comments	-	
*
*	Modification History:
*			Name			   Date					Description
*			CodeSushi	-	11/09/2010	-	Creation of this file.
**************************************************************************************/

#ifndef _PSX_SHADER_CONSTANT_H_
#define _PSX_SHADER_CONSTANT_H_

#include "PulseSTD.h"
#include "GraphicsTypes.h"
#include "String.h"

namespace Pulse
{

	class ShaderConstant
	{
	public:

		ShaderConstant( const CHAR *pName, EShaderConstantType::Type type, SIZE_T count, void *pDefaultData );
		~ShaderConstant( void );

		void SetSemantic( const CHAR *pSemantic );
		//void Cleanup( void );

		void Update( void );

		const CHAR * GetName( void ) const;
		void SetName( const CHAR *pName );
		void SetName( const String  *pName );

		const EShaderConstantType::Type GetType( void ) const;
		//void SetType( EShaderConstantType::Type type );

		const void * GetData( void ) const;
		void SetData( void *pData );

		const SIZE_T GetDataCount( void ) const;
		//void SetDataCount( SIZE_T count );

		const SIZE_T GetDataSize( void ) const;
		//void SetDataSize( SIZE_T size );

		const void * GetDefaultData( void ) const;
		void SetDefaultData( void *pData );
		void SetDefaultData( void *pData, SIZE_T count );

		const BOOL IsSemanticAvailable( void ) const;

		const BOOL IsDynamic( void ) const { return m_pSemantic != PSX_NULL; }

	private:

		String						m_name;				// Data name
		EShaderConstantType::Type	m_type; 
		SIZE_T						m_size;
		SIZE_T						m_dataCount;
		void						*m_pData;			// Stores the current value of data
		void						*m_pDefaultData;	// Stores the default value of the data
		ShaderConstantSemantic		*m_pSemantic;
		//ShaderConstantType			*m_pDataType;
		BOOL						m_bArray;
		BOOL						m_bDynamic;

	};

	PSX_INLINE const CHAR * ShaderConstant::GetName( void ) const
	{
		return m_name.GetCString();
	}

	PSX_INLINE void ShaderConstant::SetName( const CHAR *pName )
	{
		m_name = pName;
	}

	PSX_INLINE void ShaderConstant::SetName( const String  *pName )
	{
		m_name = *pName;
	}

	PSX_INLINE const EShaderConstantType::Type ShaderConstant::GetType( void ) const
	{
		return m_type;
	}

	PSX_INLINE const void * ShaderConstant::GetData( void ) const
	{
		return m_pData;
	}

	PSX_INLINE const SIZE_T ShaderConstant::GetDataCount( void ) const
	{
		return m_dataCount;
	}

	PSX_INLINE const SIZE_T ShaderConstant::GetDataSize( void ) const
	{
		return m_size;
	}

	PSX_INLINE const BOOL ShaderConstant::IsSemanticAvailable( void ) const
	{
		return m_pSemantic != PSX_NULL;
	}

	PSX_INLINE const void * ShaderConstant::GetDefaultData( void ) const
	{
		return m_pDefaultData;
	}
}

#endif /* _PSX_SHADER_CONSTANT_H_ */